//
// Created by 吴喆 on 2020/3/26.
//

#include "DemoMonsterStateMachine.h"
#include "../../engine/ResourceManager.h"

DemoMonsterStateMachine::DemoMonsterStateMachine() {
    currentState = new MonsterStandState;
}

PlayableState *MonsterStandState::handleInput(Playable &playable, KeyEvent *keyEvent) {
    return PlayableState::handleInput(playable, keyEvent);
}

PlayableState *MonsterStandState::update(Playable &playable) {
    return PlayableState::update(playable);
}

void MonsterStandState::initAnimation() {
    auto *animation = new Animation(200);
    animation->addFrame(ResourceManager::getTexture("enemies.Charger - 8x_Charger - Idle_0.png"));
    animation->addFrame(ResourceManager::getTexture("enemies.Charger - 8x_Charger - Idle_1.png"));
    animation->addFrame(ResourceManager::getTexture("enemies.Charger - 8x_Charger - Idle_2.png"));
    animation->addFrame(ResourceManager::getTexture("enemies.Charger - 8x_Charger - Idle_3.png"));
    animationMap[0] = animation;
}

void MonsterStandState::enter(Playable &playable) {
    PlayableState::enter(playable);
}

MonsterStandState::MonsterStandState() {
    initAnimation();
}
